import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'
import HomeMain from '../components/home/HomeMain.vue'
import RoleMain from '../components/role/RoleMain.vue'
import Home from '../views/Home.vue'
import Users from '../views/Users.vue'
import Roles from '../views/Roles.vue'
import Permission from '../views/Permission.vue'

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home,
      redirect: '/user',
      children: [
        {
          path: '/user',
          redirect: '/users',
          children: [
            {
              path: '/users',
              name: 'users',
              component: HomeMain
            }
          ]
        },
        {
          path: '/rights',
          redirect: '/roles',
          children: [
            {
              path: '/roles',
              name: 'roles',
              component: RoleMain
            },
            {
              path: '/permission',
              name: 'permission',
              component: Permission
            }
          ]
        }
      ]
    }
  ]
})

export default router
